<template>
<div>
  <a-row :gutter="10">
    <a-col :md="leftColMd" :sm="24" style="margin-bottom: 20px">
      <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
            </a-row>
          </a-form>
        </div>
        <!-- 查询区域-END -->

        <!-- 操作按钮区域 -->
        <div class="table-operator">
          <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
          <a-button type="primary" icon="download" @click="handleExportXls('房源单位分配')">导出</a-button>
          <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
            <a-button type="primary" icon="import">导入</a-button>
          </a-upload>
          <!-- 高级查询区域 -->
          <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
          
        </div>

        <!-- table区域-begin -->
        <div>
          <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys1.length }}</a>项
            <a style="margin-left: 24px" @click="onClearSelected1">清空</a>
          </div>

          <a-table
            ref="table"
            size="middle"
            :scroll="{x:true}"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1, type:'radio'}"
            class="j-table-force-nowrap"
            @change="handleTableChange">

            <a slot="projectName" slot-scope="text, record" @click="getProjectDetails(record.id)">{{ text }}</a>

            <span slot="action" slot-scope="text, record">
          
              <a @click="disroom(record)">分配房源</a>
              <a-divider type="vertical" />
              <a @click="applyinfo(record)">报名信息</a>
              <a-divider type="vertical" />
              <a @click="upcheck(record)">提交审核</a>
              <a-divider type="vertical" />
              <a @click="roompeople(record)">设置中签</a>

              <a-divider type="vertical" />
              <a-dropdown>
                <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
                <a-menu slot="overlay">
                  <a-menu-item>
                    <a @click="handleEdit(record)">编辑</a>
                  </a-menu-item>
                  <a-menu-item>
                    <a @click="handleDetail(record)">详情</a>
                  </a-menu-item>
                  <a-menu-item>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
            </span>

          </a-table>
        </div>
        <projectInfoDrawer ref="projectDrawer"></projectInfoDrawer>
        <znzf-room-apart-distribute-modal ref="modalForm" @ok="modalFormOk"></znzf-room-apart-distribute-modal>
      </a-card>
    </a-col>
    <a-col :md="rightColMd" :sm="24" v-if="this.rightupcolval == 1" style="margin-bottom: 20px">
      <a-tabs defaultActiveKey="1" v-model="tabActiveKey" @change = "atabsOnchange">
        <a-tab-pane tab="核定房源" key="1" >
          <a-card :bordered="false">
          
            <!-- 查询区域 -->
            <div class="table-page-search-wrapper">
              <a-form layout="inline">
                <a-row :gutter="24">

                  <a-col :md="12" :sm="12">
                    <a-form-item label="单位名称">
                      <a-input placeholder="" v-model="queryParam2.name"></a-input>
                    </a-form-item>
                  </a-col>
                  <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                  <a-col :md="9" :sm="24">
                    <a-button type="primary" @click="searchQuery2" icon="search" style="margin-left: 21px">查询</a-button>
                    <a-button type="primary" @click="searchReset2" icon="reload" style="margin-left: 8px">重置</a-button>
                    </a-col>
                  </span>
                </a-row>
              </a-form>
            </div>

            <!-- table区域-begin -->
            <div>
              <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
                <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys2.length }}</a>项
                <a style="margin-left: 24px" @click="onClearSelected2">清空</a>
              </div>
              <a-table
                ref="table"
                size="middle"
                :scroll="{x:true}"
                bordered
                rowKey="id"
                :columns="columns2"
                :dataSource="dataSource2"
                :pagination="ipagination2"
                :loading="loading2"
                :rowSelection="{selectedRowKeys: selectedRowKeys2, onChange: onSelectChange2, type:'radio'}"
                class="j-table-force-nowrap"
                @change="handleTableChange2">

                <template slot="checkedRoomNum" slot-scope="text, record">
                  <div class="editable-cell">
                    <div v-if="isEditCheckRoomnum" class="editable-cell-input-wrapper">
                      <a-input :value="text" @change="e => roomNumInputHandleChange(e.target.value, record.id)" 
                      type="number" suffix="套"/>
                    </div>
                    <div v-else class="editable-cell-text-wrapper">
                      {{ text || 0 }}套
                    </div>
                  </div>
                </template>

                <span slot="action" slot-scope="text, record">
                  <a @click="distributeRoom(record)">房源</a>
                </span>
              </a-table>
            </div>
          </a-card>
          <div class="drawer-bootom-button">
            <span class="messageSpan">
              当前总核定房源数量： {{ totalCheckRoomNum }} 
            </span>

            <a-popconfirm title="发布后各单位将开始选房，无法修改分配结果，确认吗?" @confirm="finallyDistribute()">
              <a-button :disable="editOrNotBtnDisable"
              style="margin-left: 16px;" type="primary">分配完成，发布</a-button>
            </a-popconfirm>
            
            <a-button v-if="!isEditCheckRoomnum" @click="editOrNotBtnOnclick(0)" :disable="editOrNotBtnDisable"
              style="margin-left: auto;" type="primary" ghost>核定数量</a-button>
            <a-button v-if="isEditCheckRoomnum" @click="resetCheckRoomnum()" :disable="editOrNotBtnDisable"
              style="margin-left: auto;" >重置</a-button>
            <a-button v-if="isEditCheckRoomnum" @click="editOrNotBtnOnclick(1)" :disable="editOrNotBtnDisable"
              style="margin-left: 8px;" type="primary">确认更新</a-button>

          </div>
        </a-tab-pane>
        <a-tab-pane tab="报名信息" key="2" forceRender>
          <a-card :bordered="false">
          <!-- 查询区域 -->
          <div class="table-page-search-wrapper">
            <a-form layout="inline">
              <a-row :gutter="24">
                <a-col :md="8" :sm="8">
                  <a-form-item label="职员姓名">
                    <a-input placeholder="" v-model="queryParam3.employeeName"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="8">
                  <a-form-item label="部门名称">
                    <a-input placeholder="" v-model="queryParam3.departName"></a-input>
                  </a-form-item>
                </a-col>
                <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                  <a-col :md="9" :sm="24">
                  <a-button type="primary" @click="searchQuery3" icon="search" style="margin-left: 21px">查询</a-button>
                  <a-button type="primary" @click="searchReset3" icon="reload" style="margin-left: 8px">重置</a-button>
                  </a-col>
                </span>
              </a-row>
            </a-form>
          </div>
          
          <a-table
            ref="table"
            size="middle"
            :scroll="{x:true}"
            bordered
            rowKey="id"
            :columns="columns3"
            :dataSource="dataSource3"
            :pagination="ipagination3"
            :loading="loading3"
            class="j-table-force-nowrap"
            @change="handleTableChange3">
          </a-table>
        </a-card>
        </a-tab-pane>
        <a-tab-pane tab="提交审核" key="3" forceRender>
          <a-card :bordered="false">
            <!-- 查询区域 -->
            <div class="table-page-search-wrapper">
              <a-form layout="inline">
                <a-row :gutter="24">

                  <a-col :md="12" :sm="12">
                    <a-form-item label="单位名称">
                      <a-input placeholder="" v-model="queryParam4.name"></a-input>
                    </a-form-item>
                  </a-col>
                  <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                  <a-col :md="9" :sm="24">
                    <a-button type="primary" @click="searchQuery4" icon="search" style="margin-left: 21px">查询</a-button>
                    <a-button type="primary" @click="searchReset4" icon="reload" style="margin-left: 8px">重置</a-button>
                    </a-col>
                  </span>
                </a-row>
              </a-form>
            </div>
            
            <!-- table区域-begin -->
            <div>
              <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
                <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys4.length }}</a>项
                <a style="margin-left: 24px" @click="onClearSelected4">清空</a>
              </div>
              <a-table
                ref="table"
                size="middle"
                bordered
                expandRowByClick
                :expandIconAsCell="false"
                :expandIconColumnIndex="9"
                rowKey="id"
                :columns="columns4"
                :dataSource="dataSource4"
                :pagination="ipagination4"
                :loading="loading4"
                :rowSelection="{selectedRowKeys: selectedRowKeys4, onChange: onSelectChange4}"
                class="j-table-force-nowrap"
                @change="handleTableChange4">

                  <span slot="action">
                    <a>分配房源</a>
                  </span>
                  <div slot="expandedRowRender" slot-scope="record" style="margin: 0">
                    <a-descriptions title="详情" bordered :column="1">
                      <a-descriptions-item label="房源">
                        职工姓名
                      </a-descriptions-item>
                      <a-descriptions-item v-for="(item, index) in record.detail" :key="index" :label="item.roomInfo">
                        {{item.realname}}
                      </a-descriptions-item>
                    </a-descriptions>
                  </div>
              </a-table>
            </div>
          </a-card>
          <div class="drawer-bootom-button">
            <a-button @click="checkDepartDisResult(0)" style="margin-left: auto;" type="danger">驳回</a-button>
            <a-button @click="checkDepartDisResult(1)" style="margin-left: 8px;" type="primary">审核通过</a-button>
          </div>
        </a-tab-pane>
        <a-tab-pane tab="设置中签" key="4" forceRender>
          <a-card :bordered="false">
            <!-- 查询区域 -->
            <div class="table-page-search-wrapper">
              <a-form layout="inline">
                <a-row :gutter="24">
                  <a-col :md="8" :sm="8">
                    <a-form-item label="单元">
                      <a-input placeholder="" v-model="queryParam6.unit"></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="8">
                    <a-form-item label="门牌号">
                      <a-input placeholder="" v-model="queryParam6.houseNo"></a-input>
                    </a-form-item>
                  </a-col>
                  <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                    <a-col :md="9" :sm="24">
                    <a-button type="primary" @click="searchQuery6" icon="search" style="margin-left: 21px">查询</a-button>
                    <a-button type="primary" @click="searchReset6" icon="reload" style="margin-left: 8px">重置</a-button>
                    </a-col>
                  </span>
                </a-row>
              </a-form>
            </div>
            
            <!-- table区域-begin -->
            <div>
              <a-table
                ref="table"
                size="middle"
                bordered
                rowKey="id"
                :columns="columns6"
                :dataSource="dataSource6"
                :pagination="ipagination6"
                :loading="loading6"
                class="j-table-force-nowrap"
                @change="handleTableChange6">

                <span slot="action" slot-scope="text, record">
          
                  <a @click="roomPeople(record)">设置中签</a>
                  <a-divider type="vertical" />
                  <a @click="clearPeople(record)">清除</a>
                </span>

              </a-table>
            </div>
            <SelectPeopleForRoom ref="selectPeopleForRoom" :radid="currentRADId"
              @selectFinished="selectOnePeopleOK"></SelectPeopleForRoom>
          </a-card>
          <div class="drawer-bootom-button">
            <a-popconfirm title="提交后将会有上级管理员审核，确认吗?" @confirm="submitRoomPeople()">
              <a-button style="margin-left: 16px;" type="primary">提交审核</a-button>
            </a-popconfirm>
            
            <a-button @click="easyDistributeRoomToPeople()" style="margin-left: auto;" type="primary">一键分配</a-button>

            <a-button @click="resetRoomPeople()" style="margin-left: 16px;" >重置</a-button>
            <a-button @click="saveRoomPeople()" style="margin-left: 8px;" >保存</a-button>
          </div>
        </a-tab-pane>
      </a-tabs>
    </a-col>
  </a-row>

  <a-row v-if="this.rightdowncolval == 1">
    <a-col :md="24" :sm="24" style="margin-bottom: 20px">
      <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <a-form layout="inline">
            <a-row :gutter="24">
              <a-col :md="8" :sm="8">
                <a-form-item label="单元">
                  <a-input placeholder="" v-model="queryParam5.unit"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="8">
                <a-form-item label="门牌号">
                  <a-input placeholder="" v-model="queryParam5.houseNo"></a-input>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                <a-col :md="9" :sm="24">
                <a-button type="primary" @click="searchQuery5" icon="search" style="margin-left: 21px">查询</a-button>
                <a-button type="primary" @click="searchReset5" icon="reload" style="margin-left: 8px">重置</a-button>
                </a-col>
              </span>
            </a-row>
          </a-form>
        </div>

        <div class="table-operator">
          <a-button @click="handleAdd5" type="primary" icon="plus" style="margin-top: 16px">添加房源</a-button>

          <a-dropdown v-if="selectedRowKeys5.length > 0">
            <a-menu slot="overlay">
              <a-menu-item key="1" @click="batchDel5"><a-icon type="delete"/>删除</a-menu-item>
            </a-menu>
            <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
          </a-dropdown>
        </div>

        <!-- table区域-begin -->
        <div>
          <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys5.length }}</a>项
            <a style="margin-left: 24px" @click="onClearSelected5">清空</a>
          </div>

          <a-table
            ref="table"
            size="middle"
            :scroll="{x:true}"
            bordered
            rowKey="id"
            :columns="columns5"
            :dataSource="dataSource5"
            :pagination="ipagination5"
            :loading="loading5"
            :rowSelection="{selectedRowKeys: selectedRowKeys5, onChange: onSelectChange5}"
            class="j-table-force-nowrap"
            @change="handleTableChange5">

            <span slot="action" slot-scope="text, record">
              <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete5(record.id)">
                <a>删除</a>
              </a-popconfirm>
            </span>

          </a-table>
        </div>
        <!-- 表单区域 -->
        <SelectRoomOfOneModel ref="selectRoomOfOneModel"  :radid="currentRADId" @selectFinished="selectRoomOfOneOK"></SelectRoomOfOneModel>
      </a-card>
    </a-col>
  </a-row>
</div>

</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ZnzfRoomApartDistributeModal from './modules/ZnzfRoomApartDistributeModal'
  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  import {httpAction, deleteAction, postAction, getAction} from '@/api/manage'
  import SelectRoomOfOneModel from '@/views/roomapartdistribute/modules/SelectRoomOfOneModel'
  import SelectPeopleForRoom from '@/views/roomapartdistribute/modules/SelectPeopleForRoom'
  import {filterObj} from '@/utils/util'
  import projectInfoDrawer from '@/components/znzfComponents/projectInfoDrawer'

  export default {
    name: 'ZnzfRoomApartDistributeList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      ZnzfRoomApartDistributeModal,
      SelectRoomOfOneModel,
      SelectPeopleForRoom,
      projectInfoDrawer
    },
    data () {
      return {
        description: '房源单位分配管理页面',
        selectedRowKeys1: [],
        selectionRows1: [],
        currentRADId: '',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'标题',
            align:"center",
            dataIndex: 'title'
          },
          {
            title:'所属项目',
            align:"center",
            dataIndex: 'projectName',
            scopedSlots: { customRender: 'projectName' },
          },
          {
            title:'总报名人数',
            align:"center",
            dataIndex: 'applyNumSum'
          },
          {
            title:'房源数量',
            align:"center",
            dataIndex: 'roomNum'
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'status_dictText'
          },
          {
            title:'是否完结',
            align:"center",
            dataIndex: 'isEnd_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:160,
            scopedSlots: { customRender: 'action' }
          }
        ],
        
        tabActiveKey: 1,

        rightupcolval: 0,
        queryParam2:{},
        selectedRowKeys2:[],
        selectionRows2:[],
        currentCheckDepartId: '',
        ipagination2: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        loading2: false,
        filters2: {},
        isorter2: {
          column: 'createTime',
          order: 'desc'
        },
        isEditCheckRoomnum: false,
        editOrNotBtnDisable: false,

        dataSource2:[],

        columns2: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'单位',
            align:"center",
            dataIndex: 'apart'
          },
          {
            title:'单位核定报名人数',
            align:"center",
            dataIndex: 'apartCheckPeopleNum'
          },
          {
            title:'总报名人数',
            align:"center",
            dataIndex: 'applyNumSum'
          },
          {
            title:'单位人员报名比例',
            align:"center",
            dataIndex: 'apartPeopleApplyRatio'
          },
          {
            title:'房源占比',
            align:"center",
            dataIndex: 'roomRatio'
          },
          {
            title:'核定房源数量',
            align:"center",
            dataIndex: 'checkedRoomNum',
            scopedSlots: { customRender: 'checkedRoomNum' },
          },
          
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            width:70,
            scopedSlots: { customRender: 'action' }
          }
        ],

        
        queryParam3:{},
        ipagination3: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        loading3: false,
        filters3: {},
        isorter3: {
          column: 'createTime',
          order: 'desc'
        },

        dataSource3:[
        {
          id: 'kjs568lk',
          depart: '保安管理支队',
          employeeName: '于清',
          applyTime: '2022/3/20 16:00:00',
          score: '80',
          rank: '1',
        },{
          id:'15jn51kj',
          depart: '保安管理支队',
          employeeName: '黄兰',
          applyTime: '2022/3/21 16:00:00',
          score: '60',
          rank: '2',
        }
        ],
        columns3: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'所在部门',
            align:"center",
            dataIndex: 'depart'
          },
          {
            title:'职员姓名',
            align:"center",
            dataIndex: 'name'
          },
          {
            title:'手机号',
            align:"center",
            dataIndex: 'tel'
          },
          {
            title:'报名时间',
            align:"center",
            dataIndex: 'applyTime'
          },
          {
            title:'得分',
            align:"center",
            dataIndex: 'score'
          },
        ],

        queryParam4:{},
        selectedRowKeys4:[],
        selectionRows4:[],
        ipagination4: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        loading4: false,
        filters4: {},
        isorter4: {
          column: 'createTime',
          order: 'desc'
        },

        dataSource4:[
        {
          id: 'nkasdkjasda2s6dsa51fasfas1fas',
          depart: '保安管理支队',
          departCheckNum: '19',
          applyNumSum: '20',
          ratio: '50%',
          roomRatio: '50%',
          checkRoomNum: '10',
          detail: [
            {
              room: 'A-202',
              employee: '于清'
            },
            {
              room: 'A-302',
              employee: '黄兰'
            },
          ],
        }
        ],
        columns4: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'单位',
            align:"center",
            dataIndex: 'apart'
          },
          {
            title:'单位核定报名人数',
            align:"center",
            dataIndex: 'apartCheckPeopleNum'
          },
          {
            title:'总报名人数',
            align:"center",
            dataIndex: 'applyNumSum'
          },
          {
            title:'单位人员报名比例',
            align:"center",
            dataIndex: 'apartPeopleApplyRatio'
          },
          {
            title:'房源占比',
            align:"center",
            dataIndex: 'roomRatio'
          },
          {
            title:'核定房源数量',
            align:"center",
            dataIndex: 'checkedRoomNum'
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'state_text'
          },
          {
            title: '详情',
            dataIndex: 'action',
            align:"center",
            width:70,
            scopedSlots: { customRender: 'action' }
          }
        ],



        rightdowncolval: 0,
        queryParam5: {},
        dataSource5: [],
        loading5: false,
        filters5: {},
        selectedRowKeys5: [],
        selectionRows5: [],
        isorter5: {
          column: 'createTime',
          order: 'desc'
        },
        ipagination5: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        isorter5: {
          column: 'createTime',
          order: 'desc'
        },

        dataSource5:[],
        columns5: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'产权证号',
            align:"center",
            dataIndex: 'propertyNo'
          },
          {
            title:'班组名称',
            align:"center",
            dataIndex: 'groupName'
          },
          {
            title:'单元',
            align:"center",
            dataIndex: 'unit'
          },
          {
            title:'楼层',
            align:"center",
            dataIndex: 'floor'
          },
          {
            title:'门牌号',
            align:"center",
            dataIndex: 'houseNo'
          },
          {
            title:'面积',
            align:"center",
            dataIndex: 'area'
          },
          {
            title:'收费标准',
            align:"center",
            dataIndex: 'fare'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],


        queryParam6: {},
        dataSource6: [],
        loading6: false,
        filters6: {},
        isorter6: {
          column: 'createTime',
          order: 'desc'
        },
        ipagination6: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        columns6: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'班组名称',
            align:"center",
            dataIndex: 'groupName'
          },
          {
            title:'单元',
            align:"center",
            dataIndex: 'unit'
          },
          {
            title:'门牌号',
            align:"center",
            dataIndex: 'houseNo'
          },
          {
            title:'职员姓名',
            align:"center",
            dataIndex: 'realname'
          },
          {
            title:'手机号',
            align:"center",
            dataIndex: 'phone'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:120,
            scopedSlots: { customRender: 'action' }
          }
        ],

        roomidx:'',

        url: {
          list: "/roomapartdistribute/znzfRoomApartDistribute/list",
          delete: "/roomapartdistribute/znzfRoomApartDistribute/delete",
          deleteBatch: "/roomapartdistribute/znzfRoomApartDistribute/deleteBatch",
          exportXlsUrl: "/roomapartdistribute/znzfRoomApartDistribute/exportXls",
          importExcelUrl: "roomapartdistribute/znzfRoomApartDistribute/importExcel",
          
          list2: '/roomapartdistribute/znzfCheckApart/queryByRadIdAndName',
          finallyDistribute: '/roomapartdistribute/znzfRoomApartDistribute/confirmRoomToDepart',
          list3: '/roomapartdistribute/znzfCheckApart/queryEmployeeChecked',

          list4: '/roomapartdistribute/znzfCheckApart/znzfRoomApartSelect',
          checkDepartDisResult: '/roomapartdistribute/znzfRoomApartDistribute/passOrDenyDeparts',

          list5: '/roomapartdistribute/znzfCheckApartRoomList/searchZnzfRoomByCheckApartId',
          deleteBatch5: '/roomapartdistribute/znzfCheckApartRoomList/deletesByRoomIdAndCheckApartId',
          delete5: '/roomapartdistribute/znzfCheckApartRoomList/deleteByRoomIdAndCheckApartId',


          list6: '/roomapartdistribute/znzfCheckApartRoomList/queryByRadId',
          
          updateRoomNum: '/roomapartdistribute/znzfCheckApart/saveCheckApartRoom',
          updateCheckRoomList:'/roomapartdistribute/znzfCheckApartRoomList/distributeRoom',

          easyDistributeRoomToPeople:'/roomapartdistribute/znzfCheckApartRoomList/distributeByRandom',
          submitRoomPeople: '/roomapartdistribute/znzfCheckApartRoomList/submitRoomToEmployee',
          saveRoomPeople: '/roomapartdistribute/znzfCheckApartRoomList/saveRoomToEmployee',

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
      leftColMd() {
        return this.selectedRowKeys1.length === 0 ? 24 : 8
      },
      rightColMd() {
        return this.selectedRowKeys1.length === 0 ? 0 : 16
      },
      totalCheckRoomNum() {
        let num = 0;
        for(let item of this.dataSource2){
          num += item.checkedRoomNum;
        }
        return num;
      }
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'applyInfo',text:'报名信息',dictCode:"znzf_apply,title,id"})
        fieldList.push({type:'string',value:'title',text:'标题',dictCode:''})
        fieldList.push({type:'string',value:'applyNumSum',text:'总报名人数',dictCode:''})
        fieldList.push({type:'int',value:'isLock',text:'是否锁定',dictCode:'yn'})
        fieldList.push({type:'int',value:'roomNum',text:'房源数量',dictCode:''})
        fieldList.push({type:'string',value:'currCheckPeople',text:'当前审核人',dictCode:''})
        fieldList.push({type:'string',value:'status',text:'状态',dictCode:'room_distribute_status'})
        fieldList.push({type:'int',value:'isEnd',text:'是否完结',dictCode:'yn'})
        this.superFieldList = fieldList
      },
      getProjectDetails(id){
        this.$refs.projectDrawer.showProjectInfoByRadId(id);
      },
      handleDelete1: function(id) {
        this.handleDelete(id)
        //TODO
        // this.dataSource2 = []
        // this.currentApplyId = ''
      },
      onClearSelected1() {
        this.selectedRowKeys1 = []
        this.selectionRows1 = []
        this.rightupcolval = 0
        this.rightdowncolval = 0
        this.onClearSelected2();
      },
      onSelectChange1(selectedRowKeys, selectionRows) {
        this.rightupcolval = 1
        this.tabActiveKey = '1'
        this.selectedRowKeys1 = selectedRowKeys
        this.selectionRows1 = selectionRows
        this.currentRADId = selectedRowKeys[0]
        
        this.loadData2();
      },
      disroom(record){
        this.rightupcolval = 1
        this.tabActiveKey = '1'
        this.selectedRowKeys1 = [record.id]
        this.currentRADId = record.id

        this.loadData2();
        this.rightdowncolval = 0;
        this.selectionRows5 = [];
        this.selectedRowKeys5 = [];
      },
      applyinfo(record){
        this.rightupcolval = 1
        this.tabActiveKey = '2'
        this.selectedRowKeys1 = [record.id]
        this.currentRADId = record.id

        this.loadData3();
      },
      upcheck(record){
        this.rightupcolval = 1
        this.tabActiveKey = '3'
        this.selectedRowKeys1 = [record.id]
        this.currentRADId = record.id

        this.loadData4();
      },
      roompeople(record){
        this.rightupcolval = 1
        this.tabActiveKey = '4'
        this.selectedRowKeys1 = [record.id]
        this.currentRADId = record.id

        this.loadData6();
      },
      atabsOnchange(activeKey){
        if(activeKey !== '1'){
          this.rightdowncolval = 0
          this.selectedRowKeys2 = []
          this.selectionRows2 = []
          this.currentCheckDepartId = ''
        }

        if(activeKey === '1'){
          this.loadData2();
        }
        else if(activeKey === '2'){
          this.loadData3();
        }
        else if(activeKey === '3'){
          this.loadData4();
        }
        else if(activeKey === '4'){
          this.loadData6();
        }
      },
      

      getQueryParams2() {
        //获取查询条件
        let sqp = {}
        var param = Object.assign(sqp, this.queryParam2, this.isorter2 ,this.filters2);
        param.field = this.getQueryField2();
        param.pageNo = this.ipagination2.current;
        param.pageSize = this.ipagination2.pageSize;
        return filterObj(param);
      },
      getQueryField2() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns2.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },

      loadData2(arg) {
        if (!this.url.list2) {
          this.$message.error('请设置url.list2属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination2.current = 1
        }
        if (this.currentRADId === '') return
        
        let params = this.getQueryParams2()//查询条件
        params.radId = this.currentRADId

        this.loading2 = true

        getAction(this.url.list2, params).then((res) => {
          if (res.success) {
            this.dataSource2 = res.result.records;
            if(res.result.total)
            {
              this.ipagination2.total = res.result.total;
            }else{
              this.ipagination2.total = 0;
            }
          }else{
            this.dataSource2 = [];
            this.ipagination2.total = 0;
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading2 = false
        })
      },
      searchQuery2() {
        this.loadData2(1)
      },
      searchReset2() {
        this.queryParam2 = {}
        this.loadData2(1)
      },
      handleTableChange2(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter2.column = sorter.field
          this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc'
        }
        this.ipagination2 = pagination
        this.loadData2()
      },
      onClearSelected2(){
        this.selectedRowKeys2 = []
        this.selectionRows2 = []
        this.currentCheckDepartId = ''
        this.rightdowncolval = 0
      },
      onSelectChange2(selectedRowKeys, selectionRows) {
        this.rightdowncolval = 1
        this.selectedRowKeys2 = selectedRowKeys
        this.selectionRows2 = selectionRows
        this.currentCheckDepartId = selectedRowKeys[0]

        this.loadData5();
        this.selectedRowKeys5 = [];
        this.selectionRows5 = [];
      },
      editOrNotBtnOnclick(ope){
        this.editOrNotBtnDisable = true;
        if(ope){
          //更新数据库
          if (!this.url.updateRoomNum) {
            this.$message.error('请设置url.updateRoomNum!')
            return
          }
          let updatelist=[];
          for(let item of this.dataSource2){
            updatelist.push({
              id: item.id,
              checkedRoomNum: item.checkedRoomNum,
            })
          }
          let params = updatelist
          
          postAction(this.url.updateRoomNum, params).then((res) => {
            if (res.success) {
              this.$message.success('更新成功!');
              
              this.loadData2();
            }
            else{
              this.$message.warning(res.message);
            }
            this.isEditCheckRoomnum = false;
            this.editOrNotBtnDisable = false;
          });
        }
        else{
          //开始编辑
          this.isEditCheckRoomnum = true;
          this.editOrNotBtnDisable = false;
        }
      },
      resetCheckRoomnum(){
        this.isEditCheckRoomnum = false;
        this.loadData2();
      },
      roomNumInputHandleChange(value,recordId){
        const newData = [...this.dataSource2];
        const target = newData.find(item => recordId === item.id);
        if (target) {
          target.checkedRoomNum = Number(value);
          this.dataSource2 = newData;
        }
        else
          this.$message.warning('出现错误！')
      },
      //点击分配房源按钮
      distributeRoom(record){
        this.rightdowncolval = 1
        this.selectedRowKeys2 = [record.id]
        this.currentCheckDepartId = record.id

        this.selectedRowKeys5 = [];
        this.selectionRows5 = [];
        this.loadData5();
      },
      finallyDistribute(){
        //分配房源，确定结果
        if (!this.url.finallyDistribute) {
          this.$message.error('请设置url.finallyDistribute!')
          return
        }
        let params ={
          radId: this.currentRADId,
        }
        postAction(this.url.finallyDistribute, params).then((res) => {
          if (res.success) {
            this.$message.success('发布成功!');
            
            this.onClearSelected1();
            this.loadData();
          }
          else{
            this.$message.warning(res.message);
          }
        });
      },



      getQueryParams3() {
        //获取查询条件
        let sqp = {}
        var param = Object.assign(sqp, this.queryParam3, this.isorter3 ,this.filters3);
        param.field = this.getQueryField3();
        param.pageNo = this.ipagination3.current;
        param.pageSize = this.ipagination3.pageSize;
        return filterObj(param);
      },
      getQueryField3() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns3.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },
      loadData3(arg) {
        if (!this.url.list3) {
          this.$message.error('请设置url.list3属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination3.current = 1
        }
        if (this.currentRADId === '') return
        
        let params = this.getQueryParams3()//查询条件
        params.radId = this.currentRADId

        this.loading3 = true

        getAction(this.url.list3, params).then((res) => {
          if (res.success) {
            this.dataSource3 = res.result.records;
            if(res.result.total)
            {
              this.ipagination3.total = res.result.total;
            }else{
              this.ipagination3.total = 0;
            }
          }else{
            this.dataSource3 = [];
            this.ipagination3.total = 0;
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading3 = false
        })
      },
      searchQuery3() {
        this.loadData3(1)
      },
      searchReset3() {
        this.queryParam3 = {}
        this.loadData3(1)
      },
      handleTableChange3(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter3.column = sorter.field
          this.isorter3.order = 'ascend' == sorter.order ? 'asc' : 'desc'
        }
        this.ipagination3 = pagination
        this.loadData3()
      },


      getQueryParams4() {
        //获取查询条件
        let sqp = {}
        var param = Object.assign(sqp, this.queryParam4, this.isorter4 ,this.filters4);
        param.field = this.getQueryField4();
        param.pageNo = this.ipagination4.current;
        param.pageSize = this.ipagination4.pageSize;
        return filterObj(param);
      },
      getQueryField4() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns4.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },

      loadData4(arg) {
        if (!this.url.list4) {
          this.$message.error('请设置url.list4属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination4.current = 1
        }
        if (this.currentRADId === '') return
        
        let params = this.getQueryParams4()//查询条件
        params.radId = this.currentRADId

        this.loading4 = true

        getAction(this.url.list4, params).then((res) => {
          if (res.success) {
            this.dataSource4 = res.result.records;

            for(let item of this.dataSource4){
              if(item.state === -1)
                item.state_text = '待提交'
              else if(item.state === 0)
                item.state_text = '审核通过'
              else if(item.state === 1)
                item.state_text = '待审核'
              else if(item.state === 2)
                item.state_text = '审核不通过'
            }
            
            if(res.result.total)
            {
              this.ipagination4.total = res.result.total;
            }else{
              this.ipagination4.total = 0;
            }
          }else{
            this.dataSource4 = [];
            this.ipagination4.total = 0;
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading4 = false
        })
      },
      searchQuery4() {
        this.loadData4(1)
      },
      searchReset4() {
        this.queryParam4 = {}
        this.loadData4(1)
      },
      handleTableChange4(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter4.column = sorter.field
          this.isorter4.order = 'ascend' == sorter.order ? 'asc' : 'desc'
        }
        this.ipagination4 = pagination
        this.loadData4()
      },
      onClearSelected4(){
        this.selectedRowKeys4 = []
        this.selectionRows4 = []
      },
      onSelectChange4(selectedRowKeys, selectionRows) {
        this.selectedRowKeys4 = selectedRowKeys
        this.selectionRows4 = selectionRows
      },
      checkDepartDisResult(ret){
        if(this.selectedRowKeys4.length <= 0){
          this.$message.warning('未选择审核项！')
          return;
        }
        if(!this.url.checkDepartDisResult){
          this.$message.error("请设置url.checkDepartDisResult属性!")
          return
        }
        var that = this;
        this.$confirm({
          title: '再次确认，若驳回请在下方输入原因?',
          content: h => <a-textarea placeholder="请输入审核意见" rows="4" id="checkTextarea" />,
          onOk() {
            let note = document.getElementById('checkTextarea').value;
            
            let params = {
              ret: ret,
              note: note,
              ids: that.selectedRowKeys4,
            }
            
            postAction(that.url.checkDepartDisResult, params).then((res) => {
              if (res.success) {
                that.$message.success('审核成功');
                that.loadData4();
                that.onClearSelected4();
              } else {
                that.$message.warning(res.message);
              }
            });
            
          },
          onCancel() {
            
          },
          class: 'test',
        });
      },


      //房源表
      getQueryParams5() {
        //获取查询条件
        let sqp = {}
        var param = Object.assign(sqp, this.queryParam5, this.isorter5 ,this.filters5);
        param.field = this.getQueryField5();
        param.pageNo = this.ipagination5.current;
        param.pageSize = this.ipagination5.pageSize;
        return filterObj(param);
      },
      getQueryField5() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns5.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },

      loadData5(arg) {
        if (!this.url.list5) {
          this.$message.error('请设置url.list5属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination5.current = 1
        }
        if (this.currentCheckDepartId === '' || this.selectedRowKeys2.length <= 0 || this.selectedRowKeys2[0] === '') return
        
        let params = this.getQueryParams5()//查询条件
        params.checkDepartId = this.currentCheckDepartId 

        this.loading5 = true

        getAction(this.url.list5, params).then((res) => {
          if (res.success) {
            this.dataSource5 = res.result.records;
            if(res.result.total)
            {
              this.ipagination5.total = res.result.total;
            }else{
              this.ipagination5.total = 0;
            }
          }else{
            this.dataSource5 = [];
            this.ipagination5.total = 0;
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading5 = false
        })
      },
      searchQuery5() {
        this.loadData5(1)
      },
      searchReset5() {
        this.queryParam5 = {}
        this.loadData5(1)
      },
      //删除需添加this.currentCheckDepartId 
      handleDelete5: function (id) {
        if(!this.url.delete5){
          this.$message.error("请设置url.delete5属性!")
          return
        }
        var that = this;
        let params = {
          checkApartId: this.currentCheckDepartId,
          roomId: id,
        }
        deleteAction(that.url.delete5, params).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage5(1)
            that.$message.success(res.message);
            that.loadData5();
          } else {
            that.$message.warning(res.message);
          }
        });
      },
      batchDel5: function () {
        if(!this.url.deleteBatch5){
          this.$message.error("请设置url.deleteBatch5属性!")
          return
        }
        if (this.selectedRowKeys5.length <= 0) {
          this.$message.warning('请选择一条记录！');
          return;
        } else {
          var that = this;
          let str = '';
          for(let item of this.selectedRowKeys5){
            if(str !== '') str += ',' + item;
            else str += item;
          }
          let params = {
            checkApartId: this.currentCheckDepartId,
            roomIds: str
          }
          this.$confirm({
            title: "确认删除",
            content: "是否删除选中数据?",
            onOk: function () {
              that.loading5 = true;
              deleteAction(that.url.deleteBatch5, params).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage5(that.selectedRowKeys5.length)
                  that.$message.success(res.message);
                  that.loadData5();
                  that.onClearSelected5();
                } else {
                  that.$message.warning(res.message);
                }
              }).finally(() => {
                that.loading5 = false;
              });
            }
          });
        }
      },
      onSelectChange5(selectedRowKeys, selectionRows) {
        this.selectedRowKeys5 = selectedRowKeys
        this.selectionRows5 = selectionRows
      },
      onClearSelected5(){
        this.selectedRowKeys5 = []
        this.selectionRows5 = []
      },
      handleTableChange5(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter5.column = sorter.field
          this.isorter5.order = 'ascend' == sorter.order ? 'asc' : 'desc'
        }
        this.ipagination5 = pagination
        this.loadData5()
      },
      reCalculatePage5(count){
        //总数量-count
        let total=this.ipagination5.total-count;
        //获取删除后的分页数
        let currentIndex=Math.ceil(total/this.ipagination5.pageSize);
        //删除后的分页数<所在当前页
        if(currentIndex<this.ipagination5.current){
          this.ipagination5.current=currentIndex;
        }
        console.log('currentIndex',currentIndex)
      },
      handleAdd5(){
        if (this.currentRADId == '') {
          this.$message.error('未指定具体项目id!')
        } else {
          let chrildneeddata = [];
          for(let item of this.dataSource5){
            chrildneeddata.push(item.id);
          }
          this.$refs.selectRoomOfOneModel.openThisModel(chrildneeddata);
        }
      },
      selectRoomOfOneOK(newSelectedRoomList){
        if (this.currentCheckDepartId == '') {
          this.$message.error('未指定具体部门!')
          return
        }
        if(!this.url.updateCheckRoomList){
          this.$message.error("请设置url.updateCheckRoomList属性!")
          return
        }
        var that = this;
        let params = {
          caId: this.currentCheckDepartId,
          roomIds: newSelectedRoomList,
        }
        postAction(that.url.updateCheckRoomList, params).then((res) => {
          if (res.success) {
            that.$message.success('添加成功');
            that.loadData5();
          } else {
            that.$message.warning(res.message);
          }
        });
      },



      getQueryParams6() {
        //获取查询条件
        let sqp = {}
        var param = Object.assign(sqp, this.queryParam6, this.isorter6 ,this.filters6);
        param.field = this.getQueryField6();
        param.pageNo = this.ipagination6.current;
        param.pageSize = this.ipagination6.pageSize;
        return filterObj(param);
      },
      getQueryField6() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns6.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },

      loadData6(arg) {
        if (!this.url.list6) {
          this.$message.error('请设置url.list6属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination6.current = 1
        }
        if (this.currentRADId === '' ) {
          this.$message.error('未指定bigTableId!')
          return;
        }
        
        let params = this.getQueryParams6()//查询条件
        params.radId = this.currentRADId

        this.loading6 = true

        getAction(this.url.list6, params).then((res) => {
          if (res.success) {
            this.dataSource6 = res.result.records;
            if(res.result.total)
            {
              this.ipagination6.total = res.result.total;
            }else{
              this.ipagination6.total = 0;
            }
          }else{
            this.dataSource6 = [];
            this.ipagination6.total = 0;
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading6 = false
        })
      },
      searchQuery6() {
        this.loadData6(1)
      },
      searchReset6() {
        this.queryParam6 = {}
        this.loadData6(1)
      },
      handleTableChange6(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO 筛选
        if (Object.keys(sorter).length > 0) {
          this.isorter6.column = sorter.field
          this.isorter6.order = 'ascend' == sorter.order ? 'asc' : 'desc'
        }
        this.ipagination6 = pagination
        this.loadData6()
      },
      roomPeople(record){
        //给房分配人
        if(this.currentRADId === ''){
          this.$message.warning('未指定项目！');
          return;
        }

        this.roomidx = record.id
        this.$refs.selectPeopleForRoom.openThisModel(this.dataSource6,record.uid);
      },
      clearPeople(record){
        //清除
        //let target = this.dataSource6.find(item => record.id === item.id);
        if (record) {
          record.uid = '';
          record.realname = '';
          record.phone = '';
        }
        else
          this.$message.warning('出现错误！')
      },
      easyDistributeRoomToPeople(){
        //一键分配
        if(!this.currentRADId){
          this.$message.warning('未指定项目！');
          return;
        }
        if (!this.url.easyDistributeRoomToPeople) {
          this.$message.error('请设置url.easyDistributeRoomToPeople!')
          return
        }
        let params ={radId: this.currentRADId}
        postAction(this.url.easyDistributeRoomToPeople, params).then((res) => {
          if (res.success) {
            this.$message.success('分配成功!')
            this.loadData6();
          }
          else{
            this.$message.warning(res.message);
          }
        })
      },
      resetRoomPeople(){
        //重置
        this.loadData6();
      },
      toolFunGetRoomUSer(){
        let res = [];
        for(let item of this.dataSource6){
          res.push({
            id: item.id,
            uid: item.uid,
          })
        }
        return res;
      },
      saveRoomPeople(){
        //保存
        if(!this.currentRADId){
          this.$message.warning('未指定项目！');
          return;
        }
        if (!this.url.saveRoomPeople) {
          this.$message.error('请设置url.saveRoomPeople!')
          return
        }
        let params ={
          radId: this.currentRADId,
          checkApartRoomList: this.toolFunGetRoomUSer(),
        }
        postAction(this.url.saveRoomPeople, params).then((res) => {
          if (res.success) {
            this.$message.success('保存成功!')
            this.loadData6();
            //更新按钮状态
            //TODO
          }
          else{
            this.$message.warning(res.message);
          }
        })
      },
      submitRoomPeople(){
        //提交审核
        if(!this.currentRADId){
          this.$message.warning('未指定项目！');
          return;
        }
        if (!this.url.submitRoomPeople) {
          this.$message.error('请设置url.submitRoomPeople!')
          return
        }
        let params ={
          radId: this.currentRADId,
          checkApartRoomList: this.toolFunGetRoomUSer(),
        }
        postAction(this.url.submitRoomPeople, params).then((res) => {
          if (res.success) {
            this.$message.success('提交成功!')
            this.loadData6();
            //更新按钮状态
            //TODO
          }
          else{
            this.$message.warning(res.message);
          }
        })
      },
      selectOnePeopleOK(userInfo){
        const newData = [...this.dataSource6];
        const target = newData.find(item => this.roomidx === item.id);
        if (target) {
          target.uid = userInfo.userId;
          target.realname = userInfo.realName;
          target.phone = userInfo.tel;
          this.dataSource6 = newData;
          console.log(this.dataSource6)
        }
        else
          this.$message.warning('未找到此房源！')

      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';

  .drawer-bootom-button {
    /*position: absolute;*/
    bottom: 0;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: left;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
    height:53px;
    display: flex;
    align-items: center;
  }

  .editable-cell-input-wrapper{
    width:120px;
  }
  .editable-cell-text-wrapper {
    text-align: center;
  }

</style>